home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / nt / sslaunch.zip / scrnsave.c < prev   
C/C++ Source or Header  |  1994-09-28  |  2KB  |  56 lines

  1. /*
  2.  * ScrnSave.c -- Trigger Screen Saver.
  3.  *
  4.  * Simple utility to trigger the screen saver on Windows NT.
  5.  * Works very nice when launched from RipBar (Jonathan Carroll,
  6.  * 74017.3242@compuserve.com).
  7.  *
  8.  * Thanks to Alan Phillips (A.Phillips@lancaster.ac.uk), the author
  9.  * of the Programmers File Editor (PFE), for hints on how to do this.
  10.  *
  11.  * Tested on Daytona Beta I and II, expect it works on NT 3.1.
  12.  *
  13.  * Written by Bob Beck, Sequent Computer Systems, Inc., 8/31/94.
  14.  * rbk@sequent.com, CIS: 71674,106.
  15.  */
  16.  
  17. #include <windows.h>
  18.  
  19. LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
  20.  
  21. int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
  22.                     LPSTR lpszCmdLine, int nCmdShow)
  23.  {
  24.      static char szAppName[] = "SaveScrn" ;
  25.      HWND        hwnd ;
  26.      WNDCLASS    wndclass ;
  27.  
  28.      wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
  29.      wndclass.lpfnWndProc   = WndProc ;
  30.      wndclass.cbClsExtra    = 0 ;
  31.      wndclass.cbWndExtra    = 0 ;
  32.      wndclass.hInstance     = hInstance ;
  33.      wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
  34.      wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
  35.      wndclass.hbrBackground = GetStockObject (WHITE_BRUSH) ;
  36.      wndclass.lpszMenuName  = NULL ;
  37.      wndclass.lpszClassName = szAppName ;
  38.  
  39.      RegisterClass (&wndclass) ;
  40.  
  41.      hwnd = CreateWindow (szAppName, "Screen Saver Trigger",
  42.                           WS_OVERLAPPEDWINDOW,
  43.                           CW_USEDEFAULT, CW_USEDEFAULT,
  44.                           CW_USEDEFAULT, CW_USEDEFAULT,
  45.                           NULL, NULL, hInstance, NULL) ;
  46.  
  47.      DefWindowProc (hwnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0) ;
  48.      //ExitProcess(0);
  49.      return 0;
  50.  }
  51.  
  52. LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  53.  {
  54.      return DefWindowProc (hwnd, message, wParam, lParam) ;
  55.  }
  56.